 /*******************************************************************************
 Name        : lcddrv.h
 Author      : 
 Version     : 1.0
 Copyright   : Macsolar Power
 Description : lcd driver
 ******************************************************************************/
#ifndef __LCDDRV_H__
#define __LCDDRV_H__

#ifdef __cplusplus
extern "C"
{
#endif

/******************************************************************************
                        Include    Files
*******************************************************************************/

/******************************************************************************
                        Macro      Define
*******************************************************************************/
#define LCD_RS_DIS()    FIO1SET = 1 << 21		/* P1.21 = 1*/
#define LCD_RS_EN()     FIO1CLR = 1 << 21		/* P1.21 = 0*/
#define LCD_CS_DIS()    FIO1SET = 1 << 23		/* P1.23 = 1*/
#define LCD_CS_EN()     FIO1CLR = 1 << 23		/* P1.23 = 0*/
#define LCD_RST_DIS()   FIO1SET = 1 << 22		/* P1.22 = 1*/
#define LCD_RST_EN()    FIO1CLR = 1 << 22		/* P1.22 = 0*/
#define LCD_WR_DIS()    FIO1SET = 1 << 20		/* P1.20 = 1*/
#define LCD_WR_EN()     FIO1CLR = 1 << 20		/* P1.20 = 0*/
#define LCD_RD_DIS()    FIO1SET = 1 << 19		/* P1.19 = 1*/
#define LCD_RD_EN()     FIO1CLR = 1 << 19		/* P1.19 = 0*/
#define LCD_BK_ON()     FIO1CLR = 1 << 24
#define LCD_BK_OFF()    FIO1SET = 1 << 24

#define LCD_SEND(dat)   FIO2PIN0 = (dat)

#define LCD_MAX_X       16 //
#define LCD_MAX_Y       8
/******************************************************************************
                        Struct     Define
*******************************************************************************/
enum LCD_POINT{
    POINT_4_TOP = 0,
    POINT_4_SENTER_H,
    POINT_4_SENTER_V,
    POINT_RIGHT_TRIG,
    POINT_LEFT_TRIG,
    POINT_DOUBLE_LINE,
    POINT_UP_TRIG,
    POINT_DOWN_TRIG
};
/******************************************************************************
                        Global    Variable
*******************************************************************************/

/******************************************************************************
                        Function  Declare
*******************************************************************************/
extern void BspLcdInit_3(void);
extern void BspLcdPutChar_3(U32 x, U32 y, char ch);
extern void BspLcdPutCharInv_3(U32 x,U32 y,char ch);


extern void BspLcdInit(void);

extern void BspLcdDrawAxis(U32 xFirstLine);
extern void BspLcdDrawRectangle(U32 xLine,U32 dwDat);
extern void (*BspLcdPutChar)(U32 x, U32 y, char ch);
extern void (*BspLcdPutCharInv)(U32 x,U32 y,char ch);
extern U32 BspLcdPutData(U32 x,U32 y,U32 dwDat,U32 dwW);
extern U32 BspLcdPutDataInv(U32 x,U32 y,U32 dwDat,U32 dwW);
extern void BspLcdClear(U32 x1,U32 y1,U32 x2,U32 y2);
extern int  BspLcdPrintf(U32 x,U32 y,char* str);
extern int  BspLcdPrintfInv(U32 x,U32 y,char* str);
extern void BspLcdDrawPoint(U32 x1,U32 y1,U32 x2,U32 y2,enum LCD_POINT tType);
extern void BspLcdFill(U32 x1,U32 y1,U32 x2,U32 y2);


#ifdef __cplusplus
}
#endif
 
#endif /*__LCDDRV_H__*/
